/*
 * @Author: tao
 * @Date: 2019-02-18 22:42:17
 * @Last Modified by: mikey.zhaopeng
 * @Last Modified time: 2021-05-18 17:29:33
 * @func 图片上传的相关接口
 *
 */
const Controller = require("egg").Controller;
const svgCaptcha = require("svg-captcha");
class FileController extends Controller {
  async index() {
    console.log(this.ctx.request.files);
    this.ctx.body = { msg: "file ok" };
  }
  async captcha() {
    const captcha = svgCaptcha.create();
    this.ctx.cookies.set("captcha", captcha.text);
    this.ctx.response.type = 'svg'
    this.ctx.body = captcha.data;
  }
}

module.exports = FileController;
